#include<iostream>
#include<unordered_set>

using namespace std;


int main()
{
	int a; scanf("%d", &a);
	while (a--)
	{
		unordered_set<int>mp;
		int c; scanf("%d", &c);
		while (c--)
		{
			int b; scanf("%d", &b);
			if (mp.count(b) == 0)
			{
				mp.insert(b);
				cout << b << " ";
			}
		}
		cout << endl;
	}
	return 0;
}
